```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kafka数据清理与过期策略详解</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f9fafb;
            color: #1f2937;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .section-title {
            position: relative;
            padding-bottom: 0.5rem;
        }
        .section-title:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 3rem;
            height: 0.25rem;
            background: #6366f1;
            border-radius: 0.125rem;
        }
        .first-letter:first-letter {
            float: left;
            font-size: 4rem;
            line-height: 0.8;
            margin: 0.2em 0.5rem 0 0;
            color: #6366f1;
            font-weight: 700;
        }
        .mermaid-tooltip {
            background: #fff !important;
            border: 1px solid #e5e7eb !important;
            border-radius: 0.375rem !important;
            padding: 0.75rem !important;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto">
            <div class="flex flex-col items-center text-center">
                <div class="inline-flex items-center bg-white bg-opacity-20 rounded-full px-4 py-2 mb-6">
                    <i class="fas fa-database mr-2"></i>
                    <span class="font-medium">分布式消息系统</span>
                </div>
                <h1 class="text-4xl md:text-6xl font-bold mb-6 font-serif">Kafka数据清理与过期策略</h1>
                <p class="text-xl md:text-2xl max-w-3xl opacity-90 leading-relaxed first-letter">
                    Kafka作为高吞吐量的分布式消息系统，其数据清理与过期策略是保证系统性能和有效管理存储空间的关键组成部分。本文将深入解析Kafka的两种主要清理机制：基于时间的过期策略和基于大小的清理策略。
                </p>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
        <div class="grid grid-cols-1 md:grid-cols-12 gap-8">
            <!-- Sidebar -->
            <div class="md:col-span-3">
                <div class="sticky top-8">
                    <div class="bg-white rounded-xl shadow-md p-6">
                        <h3 class="text-lg font-bold mb-4 text-gray-800">内容导航</h3>
                        <ul class="space-y-3">
                            <li><a href="#storage-model" class="flex items-center text-indigo-600 hover:text-indigo-800 transition"><i class="fas fa-layer-group mr-2"></i> 数据存储模型</a></li>
                            <li><a href="#cleanup-policies" class="flex items-center text-gray-700 hover:text-indigo-600 transition"><i class="fas fa-tasks mr-2"></i> 清理策略</a></li>
                            <li><a href="#cleanup-mechanism" class="flex items-center text-gray-700 hover:text-indigo-600 transition"><i class="fas fa-broom mr-2"></i> 日志清理机制</a></li>
                            <li><a href="#cleanup-process" class="flex items-center text-gray-700 hover:text-indigo-600 transition"><i class="fas fa-cogs mr-2"></i> 清理过程</a></li>
                            <li><a href="#configuration" class="flex items-center text-gray-700 hover:text-indigo-600 transition"><i class="fas fa-sliders-h mr-2"></i> 配置与调优</a></li>
                            <li><a href="#monitoring" class="flex items-center text-gray-700 hover:text-indigo-600 transition"><i class="fas fa-chart-line mr-2"></i> 监控与预警</a></li>
                        </ul>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 mt-6">
                        <h3 class="text-lg font-bold mb-4 text-gray-800">关键概念</h3>
                        <div class="space-y-4">
                            <div>
                                <div class="flex items-center text-indigo-600 mb-1">
                                    <i class="fas fa-clock mr-2"></i>
                                    <span class="font-medium">保留时间</span>
                                </div>
                                <p class="text-sm text-gray-600">消息在Kafka中保留的最长时间</p>
                            </div>
                            <div>
                                <div class="flex items-center text-indigo-600 mb-1">
                                    <i class="fas fa-database mr-2"></i>
                                    <span class="font-medium">保留大小</span>
                                </div>
                                <p class="text-sm text-gray-600">主题分区最大存储限制</p>
                            </div>
                            <div>
                                <div class="flex items-center text-indigo-600 mb-1">
                                    <i class="fas fa-trash-alt mr-2"></i>
                                    <span class="font-medium">删除模式</span>
                                </div>
                                <p class="text-sm text-gray-600">定期删除过期消息</p>
                            </div>
                            <div>
                                <div class="flex items-center text-indigo-600 mb-1">
                                    <i class="fas fa-compress-alt mr-2"></i>
                                    <span class="font-medium">压缩模式</span>
                                </div>
                                <p class="text-sm text-gray-600">保留每个键的最新消息</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Content -->
            <div class="md:col-span-9">
                <!-- Data Storage Model -->
                <section id="storage-model" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-layer-group text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">1. 数据存储模型</h2>
                    </div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                        <div class="p-8">
                            <p class="text-lg text-gray-700 leading-relaxed mb-6">
                                Kafka中的数据以日志的形式存储，每个主题由多个分区组成，每个分区又由多个日志段（log segment）构成。这种结构使得Kafka能够高效地处理大量消息，但同时也需要合理的清理策略来管理这些数据。
                            </p>
                            <div class="bg-gray-50 p-6 rounded-lg">
                                <div class="mermaid">
                                    graph LR
                                        A[Kafka Topic] --> B[Partition 1]
                                        A --> C[Partition 2]
                                        A --> D[Partition 3]
                                        B --> E[Log Segment 1]
                                        B --> F[Log Segment 2]
                                        B --> G[Log Segment ...]
                                        C --> H[Log Segment 1]
                                        C --> I[Log Segment ...]
                                        D --> J[Log Segment 1]
                                        D --> K[Log Segment ...]
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Cleanup Policies -->
                <section id="cleanup-policies" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-tasks text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">2. 清理策略</h2>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                            <div class="p-6">
                                <div class="flex items-center mb-4">
                                    <div class="bg-purple-100 rounded-full p-2 mr-3">
                                        <i class="fas fa-clock text-purple-600"></i>
                                    </div>
                                    <h3 class="text-xl font-bold text-gray-800">保留时间 (Retention Time)</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    每个主题都可以设置一个消息保留时间，当消息在Kafka中存储超过该时间后，系统会自动清理这些过期的消息。这个时间设置可以通过<code class="bg-gray-100 px-2 py-1 rounded text-sm">retention.ms</code>参数配置。
                                </p>
                                <div class="bg-purple-50 p-4 rounded-lg">
                                    <div class="flex items-start">
                                        <i class="fas fa-info-circle text-purple-500 mt-1 mr-2"></i>
                                        <p class="text-sm text-purple-800">
                                            例如，设置<code class="bg-purple-100 px-1 py-0.5 rounded">retention.ms=604800000</code>表示消息将保留7天（604800秒）。
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                            <div class="p-6">
                                <div class="flex items-center mb-4">
                                    <div class="bg-indigo-100 rounded-full p-2 mr-3">
                                        <i class="fas fa-database text-indigo-600"></i>
                                    </div>
                                    <h3 class="text-xl font-bold text-gray-800">保留大小 (Retention Size)</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    除了基于时间的清理，Kafka还允许配置每个主题的最大存储大小(<code class="bg-gray-100 px-2 py-1 rounded text-sm">retention.bytes</code>)。当主题的存储大小超过该限制时，Kafka会删除最早的消息以释放空间。
                                </p>
                                <div class="bg-indigo-50 p-4 rounded-lg">
                                    <div class="flex items-start">
                                        <i class="fas fa-info-circle text-indigo-500 mt-1 mr-2"></i>
                                        <p class="text-sm text-indigo-800">
                                            这两种策略可以单独使用，也可以组合使用，根据业务需求灵活设置。
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Cleanup Mechanism -->
                <section id="cleanup-mechanism" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-broom text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">3. 日志清理机制</h2>
                    </div>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-10">
                        <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                            <div class="p-6">
                                <div class="flex items-center mb-4">
                                    <div class="bg-red-100 rounded-full p-2 mr-3">
                                        <i class="fas fa-trash-alt text-red-600"></i>
                                    </div>
                                    <h3 class="text-xl font-bold text-gray-800">删除 (Delete) 模式</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    在这种模式下，Kafka根据设置的保留时间和大小，定期扫描分区中的日志文件，并删除那些过期的消息。这种方式适合大多数使用场景，因为它简单且易于理解。
                                </p>
                                <div class="flex items-center text-sm text-gray-500">
                                    <i class="fas fa-check-circle text-green-500 mr-2"></i>
                                    <span>系统会在后台定期检查并清理过期数据，确保日志的有效性和存储空间的合理使用</span>
                                </div>
                            </div>
                        </div>
                        <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                            <div class="p-6">
                                <div class="flex items-center mb-4">
                                    <div class="bg-green-100 rounded-full p-2 mr-3">
                                        <i class="fas fa-compress-alt text-green-600"></i>
                                    </div>
                                    <h3 class="text-xl font-bold text-gray-800">压缩 (Compact) 模式</h3>
                                </div>
                                <p class="text-gray-700 mb-4">
                                    压缩模式保留每个键(key)最新的消息，同时删除旧版本的消息。这对于需要保持最新状态而又不需要完整历史记录的场景尤为适用，如数据库变更日志(Change Data Capture，CDC)。
                                </p>
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <div class="flex items-start">
                                        <i class="fas fa-cog text-green-500 mt-1 mr-2"></i>
                                        <p class="text-sm text-green-800">
                                            压缩模式可以通过设置<code class="bg-green-100 px-1 py-0.5 rounded">cleanup.policy=compact</code>来启用
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden">
                        <div class="p-8">
                            <div class="mermaid">
                                flowchart LR
                                    A[Kafka日志清理] --> B{清理策略}
                                    B -->|时间/大小限制| C[删除模式]
                                    B -->|键值保留| D[压缩模式]
                                    C --> E[定期删除过期消息]
                                    D --> F[保留每个键最新消息]
                                    E --> G[释放存储空间]
                                    F --> G
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Cleanup Process -->
                <section id="cleanup-process" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-cogs text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">4. 清理过程</h2>
                    </div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                        <div class="p-8">
                            <p class="text-lg text-gray-700 leading-relaxed mb-8">
                                Kafka的清理过程是异步的，由后台线程管理，确保不影响正常的生产和消费性能。以下是详细的清理步骤：
                            </p>
                            <div class="space-y-6">
                                <div class="flex">
                                    <div class="flex-shrink-0 mr-4">
                                        <div class="flex items-center justify-center w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 font-bold">1</div>
                                    </div>
                                    <div>
                                        <h4 class="text-xl font-semibold text-gray-800 mb-2">背景任务</h4>
                                        <p class="text-gray-700">Kafka broker会定期执行日志清理任务，这一过程由后台线程管理。</p>
                                    </div>
                                </div>
                                <div class="flex">
                                    <div class="flex-shrink-0 mr-4">
                                        <div class="flex items-center justify-center w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 font-bold">2</div>
                                    </div>
                                    <div>
                                        <h4 class="text-xl font-semibold text-gray-800 mb-2">查找过期数据</h4>
                                        <p class="text-gray-700">根据配置的保留时间或大小，Kafka会扫描分区中的日志，查找需要被清理的消息。</p>
                                    </div>
                                </div>
                                <div class="flex">
                                    <div class="flex-shrink-0 mr-4">
                                        <div class="flex items-center justify-center w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 font-bold">3</div>
                                    </div>
                                    <div>
                                        <h4 class="text-xl font-semibold text-gray-800 mb-2">删除操作</h4>
                                        <p class="text-gray-700">对于删除模式，Kafka会将过期消息从日志中删除；对于压缩模式，它会识别每个键的最新消息，并删除旧版本的消息。</p>
                                    </div>
                                </div>
                                <div class="flex">
                                    <div class="flex-shrink-0 mr-4">
                                        <div class="flex items-center justify-center w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 font-bold">4</div>
                                    </div>
                                    <div>
                                        <h4 class="text-xl font-semibold text-gray-800 mb-2">优化存储</h4>
                                        <p class="text-gray-700">清理完成后，Kafka会优化存储结构，释放被删除消息占用的空间。</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Configuration -->
                <section id="configuration" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-sliders-h text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">5. 配置与调优</h2>
                    </div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                        <div class="p-8">
                            <p class="text-lg text-gray-700 leading-relaxed mb-6">
                                为了优化数据清理过程，Kafka提供了多个相关的配置参数。根据业务的具体需求，合理配置这些参数可以有效提升系统的性能和存储效率。
                            </p>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead class="bg-gray-50">
                                        <tr>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">参数</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">描述</th>
                                            <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">默认值</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white divide-y divide-gray-200">
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600"><code>log.retention.hours</code></td>
                                            <td class="px-6 py-4 text-sm text-gray-700">设置消息的保留时间，以小时为单位</td>
                                            <td class="px-6 py-4 text-sm text-gray-500">168 (7天)</td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600"><code>log.retention.bytes</code></td>
                                            <td class="px-6 py-4 text-sm text-gray-700">设置每个主题的最大存储大小</td>
                                            <td class="px-6 py-4 text-sm text-gray-500">-1 (无限制)</td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600"><code>log.segment.bytes</code></td>
                                            <td class="px-6 py-4 text-sm text-gray-700">控制日志段的大小，以便于管理和清理</td>
                                            <td class="px-6 py-4 text-sm text-gray-500">1GB</td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600"><code>log.cleanup.policy</code></td>
                                            <td class="px-6 py-4 text-sm text-gray-700">设置清理策略，delete或compact</td>
                                            <td class="px-6 py-4 text-sm text-gray-500">delete</td>
                                        </tr>
                                        <tr>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600"><code>log.retention.check.interval.ms</code></td>
                                            <td class="px-6 py-4 text-sm text-gray-700">检查日志保留条件的频率</td>
                                            <td class="px-6 py-4 text-sm text-gray-500">300000 (5分钟)</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="mt-6 bg-blue-50 p-6 rounded-lg">
                                <div class="flex">
                                    <div class="flex-shrink-0">
                                        <i class="fas fa-lightbulb text-blue-500 text-2xl mr-4"></i>
                                    </div>
                                    <div>
                                        <h3 class="text-lg font-medium text-blue-800 mb-2">配置建议</h3>
                                        <p class="text-blue-700">
                                            对于高吞吐量系统，建议将<code class="bg-blue-100 px-1 py-0.5 rounded">log.segment.bytes</code>设置为较大值(如1GB)以减少段文件数量；
                                            对于需要长期保留关键数据的系统，可以设置较长的<code class="bg-blue-100 px-1 py-0.5 rounded">log.retention.hours</code>或使用压缩模式。
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Monitoring -->
                <section id="monitoring" class="mb-16">
                    <div class="flex items-center mb-8">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-chart-line text-indigo-600 text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold text-gray-900 section-title">6. 监控与预警</h2>
                    </div>
                    <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition duration-300">
                        <div class="p-8">
                            <p class="text-lg text-gray-700 leading-relaxed mb-6">
                                在清理过程中，监控日志的状态和存储使用情况是至关重要的。Kafka提供了多种指标，可以监控每个主题的消息数量、存储大小以及清理操作的效果。这些指标有助于及时发现存储问题和调整清理策略。
                            </p>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div class="bg-gray-50 p-6 rounded-lg">
                                    <h4 class="text-lg font-semibold text-gray-800 mb-4 flex items-center">
                                        <i class="fas fa-ruler-combined text-indigo-500 mr-2"></i>
                                        关键监控指标
                                    </h4>
                                    <ul class="space-y-3">
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">日志段数量 (<code class="bg-gray-100 px-1 py-0.5 rounded">LogSegmentCount</code>)</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">日志大小 (<code class="bg-gray-100 px-1 py-0.5 rounded">Size</code>)</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">最早消息偏移量 (<code class="bg-gray-100 px-1 py-0.5 rounded">LogStartOffset</code>)</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">清理操作次数 (<code class="bg-gray-100 px-1 py-0.5 rounded">CleanerRecopyPercent</code>)</span>
                                        </li>
                                    </ul>
                                </div>
                                <div class="bg-gray-50 p-6 rounded-lg">
                                    <h4 class="text-lg font-semibold text-gray-800 mb-4 flex items-center">
                                        <i class="fas fa-bell text-red-500 mr-2"></i>
                                        预警策略
                                    </h4>
                                    <ul class="space-y-3">
                                        <li class="flex items-start">
                                            <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">日志大小接近保留限制阈值</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">日志段数量异常增长</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">清理操作频率异常</span>
                                        </li>
                                        <li class="flex items-start">
                                            <i class="fas fa-exclamation-triangle text-yellow-500 mt-1 mr-2"></i>
                                            <span class="text-gray-700">磁盘空间使用率过高</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="mt-6 bg-yellow-50 p-6 rounded-lg">
                                <div class="flex">
                                    <div class="flex-shrink-0">
                                        <i class="fas fa-tools text-yellow-500 text-2xl mr-4"></i>
                                    </div>
                                    <div>
                                        <h3 class="text-lg font-medium text-yellow-800 mb-2">监控工具</h3>
                                        <p class="text-yellow-700">
                                            可以使用Kafka自带的JMX指标，配合Prometheus和Grafana搭建监控系统，或使用Confluent Control Center等专业工具进行可视化监控。
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col items-center">
                <div class="text-xl font-bold text-white mb-2">技术小馆</div>
                <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-150">http://www.yuque.com/jtostring</a>
                <div class="mt-6 flex space-x-6">
                    <a href="#" class="text-gray-400 hover:text-white transition duration-150">
                        <i class="fab fa-github text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-150">
                        <i class="fab fa-twitter text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-150">
                        <i class="fab fa-linkedin text-xl"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            themeCSS: `
                .node rect {
                    fill: #f3f4f6;
                    stroke: #6366f1;
                    stroke-width: 2px;
                }
                .node text {
                    font-family: 'Noto Sans SC', sans-serif;
                }
                .edgePath path {
                    stroke: #9ca3af;
                    stroke-width: 1.5px;
                }
                .cluster rect {
                    fill: #eef2ff;
                    stroke: #a5b4fc;
                    stroke-width: 1.5px;
                    rx: 5;
                    ry: 5;
                }
            `
        });
    </script>
</body>
</html>
```